package com.rocket.util;

import android.text.Editable;
import android.text.TextWatcher;
import android.widget.EditText;


public class MyTextWatcher implements TextWatcher{
	
	EditText mEditText;
	
	public MyTextWatcher(EditText et){
		mEditText = et;
	}

	@Override
	public void afterTextChanged(Editable s) {
		int length = s.length();
		if(length>4){
			mEditText.setText(s.toString().subSequence(0, 4));
			mEditText.setSelection(4);
		}
	}

	@Override
	public void beforeTextChanged(CharSequence s, int start, int count, int after) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void onTextChanged(CharSequence s, int start, int before, int count) {
		
	}

}
